<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>华胜后台管理</title>
    <link rel="stylesheet" type="text/css" href="css/unified.css">
    <script src="plugins/layui/layui.js"></script>
  </head>

  <body>
    <div class="breadcrumbnav">
      <span class="layui-breadcrumb " lay-separator="·">
			  <a ><cite>首页</cite></a>
			  <a ><cite>退款&售后</cite></a>
			</span>
    </div>
    <div class="kit-doc">
      <!-- 标题 -->

      <div class="kit-doc-title">

        <fieldset>
          <legend>
            <a name="blockquote">退款&售后</a>
          </legend>
        </fieldset>
      </div>
      <!-- 标题 end-->

      <!-- 概述 -->
      <div class="boderbox">
        <!--<div class="rowtop">
          <button class="layui-btn addbtn openwinbtn" data-method="addmang">
   添加+
</button>-->

          <!--<form class="layui-form searchform" action="" id="comSearchForm">
            <div class="layui-input-inline">
              <input type="text" name="text" required lay-verify="required" placeholder="输入关键字" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-btn-group">
              <button class="layui-btn">搜索</button>
              <button class="layui-btn layui-btn-normal">重置</button>
            </div>
          </form>-->
        <!--</div>-->

        <div class="layui-tab-content notab">
          <div class="layui-tab-item layui-show">

            <table class="layui-table " lay-filter="table100" id="cctable"></table>

          </div>
        </div>
        <iframe id="framFile" name="framFile" style="display: none;"></iframe>
        <iframe id="framFile1" name="framFile1" style="display: none;"></iframe>
        <!--<script id="openbox" type="text/html">
  <div class=" layui-layer-wrap margin1020">
  <form class="layui-form " action="" id="">

  </form>
</div>

</script>-->
        <script id="addBox" type="text/html">
          <div class=" layui-layer-wrap">
            <form class="layui-form layui-form-pane" action="" id="addform">
              <div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
                <div class="layui-form-item">
                  <label class="layui-form-label">订单编号</label>
                  <div class="layui-input-block">
                    <input type="text" name="salesmanName" autocomplete="off" lay-verify="number|required" placeholder="" class="layui-input">
                  </div>
                </div>
              </div>
              <div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
                <div class="layui-form-item">
                  <label class="layui-form-label">业务员编号</label>
                  <div class="layui-input-block">
                    <input type="text" name="openId" autocomplete="off" lay-verify="required" placeholder="" class="layui-input">
                  </div>
                </div>
              </div>

              <div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
                <div class="layui-form-item">
                  <label class="layui-form-label">加入时间</label>
                  <div class="layui-input-block">
                    <input type="text" id="addTime" name="addTime" class="layui-input" >
                    <!-- <input type="text" name="createTime" autocomplete="off" lay-verify="required"  placeholder="" class="layui-input">-->
                  </div>
                </div>
              </div>
              <div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
                <div class="layui-form-item">
                  <label class="layui-form-label">地区编码</label>
                  <div class="layui-input-block">
                    <input type="text" name="adcode" autocomplete="off" lay-verify="number|required" placeholder="" class="layui-input">
                  </div>
                </div>
              </div>
              <div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
                <div class="layui-form-item">
                  <label class="layui-form-label">地区</label>
                  <div class="layui-input-block">
                    <input type="text" name="region" autocomplete="off" lay-verify="required" placeholder="" class="layui-input">
                  </div>
                </div>
              </div>
              <div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
                <div class="layui-form-item">
                  <label class="layui-form-label">微信id</label>
                  <div class="layui-input-block">
                    <input type="text" name="wechatId" lay-verify="required" autocomplete="off" class="layui-input" placeholder="">
                  </div>
                </div>
              </div>

              <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
                <div class="layui-form-item">
                  <label class="layui-form-label">介绍</label>
                  <div class="layui-input-block">
                    <textarea name="introduce" placeholder="请输入客服介绍" class="layui-textarea"></textarea>

                  </div>
                </div>
              </div>
              </form>
              <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
                 <div class="layui-form-item">
                 	
                 	<!--<form action="http://hsmytest.vrdete.com/api/qiniu/update" method="post"  enctype="multipart/form-data" target="framFile"  class="updataform"  >--> 
                 		<!--<input type="file" name="files"  multiple="true" class="file_upload" />  </form>-->
                 	
                 	<form action="#" method="post"  enctype="multipart/form-data" target="framFile1"  class="updataform1 imgbox"  > 
                
	                  	<input type="button" class="layui-btn-primary imgbtn"  value="选择头像" />
	                    <input type="file" class=" imgfile"  name="files"   multiple="true"   value="选择文件" accept="image/*" onchange="xmTanUploadImg(this)" />
	                  	<input type="button" class="layui-btn upNewimg"  value="确认上传"  style=""/>
	                   
	                    <img id="xmTanImg" class="xmTanImg"  />
	        

                  </form>
                	
	                  	
                </div>
                 
                

            </div>
             
          </div>
        </script>

        <script src="js/jquery-3.2.1.min.js"></script>
        <script type="text/javascript" src="js/allajax.js"></script>
        <script>
          layui.use(['layer', 'form', 'element', 'table', 'laydate', 'laypage'], function() {
            var layer = layui.layer,
              form = layui.form,
              element = layui.element,
              table = layui.table,
              laydate = layui.laydate,
              laypage = layui.laypage;
            laydate.render({
              elem: '#addTime' //指定元素
            });

            //  目录查询全部树
            var tableArray = new Array();
            EEListFn(1 ,100 );
            function EEListFn(curr ,limit ){
              AjaxPostFn('system/orderinfo/refunds/select?page=1&pagesize=11', "{}", function(jsonData) {
                if(jsonData.pageInfo.size != 0) {
									
                  $.each(jsonData.pageInfo.list, function(idx, obj) {
                    tableArray.push({
                      "id": obj.id,
                      "operation": "<a class='layui-btn layui-bg-red ' lay-event='DelThis'>删除</a>",
                      "orderNumber": 4562156,
			                "userId": obj.userId,
			                "refundsState": obj.refundsState,
			                "refundsPaymentAmount": obj.refundsPaymentAmount,
			                "refundsExplain": obj.refundsExplain,
			                "refundsCause": obj.refundsCause,
			                "refundsExpressNumber": obj.refundsExpressNumber,
			                "refundsExpressBusiness": obj.refundsExpressBusiness,
			                "refundsGenerateTime":getMyDate( obj.refundsGenerateTime ),
			                "deliveryNumber": obj.deliveryNumber,
			                "orderMachineIp": obj.orderMachineIp,
			                "orderType": obj.orderType,
			                "scoreRefunds": obj.scoreRefunds,
			                "serviceAdminId": obj.serviceAdminId,
			                "approvalTime": getMyDate( obj.approvalTime ),
			                "warrantyCard": obj.warrantyCard,
			                "packageIntegrity": obj.packageIntegrity,
			                "barterExpressNumber": obj.barterExpressNumber,
			                "barterExpressName": obj.barterExpressName,
			                "newOrderNumber": obj.newOrderNumber
                    });

                  })
                  console.log(tableArray)
                }
                  //    system/catalog/deletecatalogbyId

                  //展示已知数据
                  var tableIns = table.render({
                    elem: '#cctable',
                    cols: [
                      [ //标题栏
                      {type:'numbers',fixed: 'left',title: '行号'},
                        {
                          field: 'id',
                          minWidth: '0%',
                          width: '0%',
                          type: 'space',
                          style: 'display:none'
                        },{
                          field: 'operation',
                          width: 80,
                          title: '操作',fixed: 'left'
                        },
                        {field: 'orderNumber',width: 150,title: '订单编号'},
                        {field: 'userId',width: 150,title: '用户id'},
                        {field: 'refundsState',width: 150,title: '退款状态 Warranty 保修 PartPrice部分退款 FullPrice 全额退款'},
                        {field: 'refundsPaymentAmount',width: 150,title: '退款付款金额'},
                        {field: 'refundsExplain',width: 150,title: '退款说明'},
                        {field: 'refundsCause',width: 150,title: '退款原因'},
                        {field: 'refundsExpressNumber',width: 150,title: '退款快递编号'+modDot,edit: 'text'},
                        {field: 'refundsExpressBusiness',width: 150,title: '快递商家'+modDot,edit: 'text'},
                        {field: 'refundsGenerateTime',width: 150,title: '生成时间'},
                        {field: 'deliveryNumber',width: 150,title: '退货取货点编码'+modDot,edit: 'text'},
                        {field: 'orderMachineIp',width: 150,title: '订单机器人ip'},
                        {field: 'orderType',width: 150,title: '保修订单的类型     refunds退款  guarantee 保修'},
			             			{field: 'scoreRefunds',width: 150,title: '需要几多积分'},
			             			{field: 'serviceAdminId',width: 150,title: '审核管理员'},
			             			{field: 'approvalTime',width: 150,title: '审核时间'},
			             			{field: 'warrantyCard',width: 150,title: '是否有保修卡 1有 0没'},
			             			{field: 'packageIntegrity',width: 150,title: '是否包装完整'},
			             			{field: 'barterExpressNumber',width: 150,title: '换货快递'},
			             			{field: 'barterExpressName',width: 150,title: '换货快递名'},
			             			{field: 'newOrderNumber',width: 150,title: '新的订单编号'}

                      ]
                    ],
                    data: tableArray,
                    id: 'cctableid',
                    size: 'lg',
                    height: 'full-250',
                    even: true,
                    page: true, //是否显示分页
                    done: function(){
                      laypage.render({
                          elem: 'layui-table-page1' //注意，这里的 test1 是 ID，不用加 # 号
                          ,count: jsonData.pageInfo.total//数据总数，从服务端得到
                          ,jump: function(obj, first){
                            //首次不执行
                            if(!first){
                              //do something
                              EEListFn(obj.curr,obj.limit);
                            }
                          }
                      });
                      
                      //图片点击放大
                     	TopimgFn();
                      	
                      	
                      	
                    
                    }
                  });//数据渲染结束
                })
              
            } //listfn结束
              //监听单元格编辑
              table.on('edit(table100)', function(obj) {
                var value = obj.value //得到修改后的值
                  ,
                  data = obj.data //得到所在行所有键值
                  ,
                  field = obj.field; //得到字段

                data.refundsGenerateTime = new Date().getTime(data.refundsGenerateTime);
                data.approvalTime = new Date().getTime(data.approvalTime);
                AjaxPostFn('system/orderinfo/refunds/update', JSON.stringify(data), function(jsonData) {

                  if(jsonData.htmlState.status == 200) {
                    layer.msg("修改成功");
                  }
                })
              });

              table.on('tool(table100)', function(obj) {
                var data = obj.data;
                if(obj.event === 'DelThis') {
                  //                      layer.msg('ID：'+ data.id + ' 的查看操作');
                  layer.confirm('是否删除该条分类信息', function(index) {
                    AjaxPostFn('system/orderinfo/refunds/deletebykey', "{'id':'" + data.id + "'}", function(jsonData) {
                      if(jsonData.htmlState.status == 200) {
                        layer.msg("删除成功");

                      } else {}
                    })
                    obj.del();
                    layer.close(index);

                  });
                } 
              });

          
            $('.openwinbtn').on('click', function() {
              var othis = $(this),
                method = othis.data('method');
              active[method] ? active[method].call(this, othis) : '';
            });

            var active = {
              //                 弹出框事件
              addmang: function() {
                layer.open({
                	type: 1, 
                  skin: 'layui-layer-molv',
                  title: '新增保修服务',
                  area: ['800px', '600px'],
                  content: $("#addBox").html(),
                  skin: 'demo-class',
                  btn: ["确认新增", "关闭"],
                  yes: function(index, layero) {
                    //按钮1的回调
					 
//                 
//                  	var thisdata = $("#addform").serializeJson();
//	                    thisdata.headPhoto = imgdata;
//	                    AjaxPostFn('system/salesman/insertinfo', JSON.stringify(thisdata), function(jsonData) {
//		
//		                      if(jsonData.htmlState.status == 200) {
//		                      layer.msg("增加成功");
//		                      location.reload();
////		http://p2816srbo.bkt.clouddn.com/FvUtmSe1jLhZjSsH3RpiTPYmmba5
//		                      }
//		                    })
                   
                    

										

                  },
                  btn2: function(index, layero) {
                    //按钮2的回调
                  },
                  cancel: function() {
                    //右上关闭的回调
                  },
                  success: function() {
					//form初始化
                    form.render();
                    	$(".upNewimg").val("点击上传");
                    //日期选择初始化
					          laydate.render({ 
										  elem: '#addTime',
										  type: 'datetime',
										  max: getnowtime()
										});
										
                  }
                })
              }
            }
          });
          
          
          
        </script>
      </div>
      <!-- 概述 end-->
    </div>
  </body>

</html>